using FluentValidation;
using FluentValidation.Attributes;
using Quickie.Models;
using Quickie.Models.IoC;
using Quickie.Models.Data;
using Quickie.Models.Entities;
using Quickie.Models.ViewModel;
using Quickie.Models.Interfaces;

namespace Quickie.Models.Entities
{
    /// <summary>
    /// Klasa koja predstavlja entitet Category
    /// Partial jer je vec preko L2S definirana u .dbml 
    /// datoteci. Atribut se odnosi na Fluent Validation validator
    /// </summary>
    [Validator(typeof(CategoryValidation))]
    public partial class Category : IEntity
    {
        
    }

    /// <summary>
    /// Klasa koja predstavlja validator za klasu Category
    /// </summary>
    public class CategoryValidation : AbstractValidator<Category>
    {
        public CategoryValidation()
        {
            RuleFor(x => x.Name)
                .NotEmpty()
                .WithMessage("Unesite naziv kategorije");
        }

    }
}